﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;

namespace IDE_week2_Forms_Project
{
    public partial class Form1 : Form
    {
        private int currentLang = 0;
        public Form1()
        {
            InitializeComponent();
            
        }

        private void btnCallClass1_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            label1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];
        }

        private void btnChangeIcon_Click(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.Icon1;
        }

        private void btnResetIcon_Click(object sender, EventArgs e)
        {
            this.Icon=null;
        }

        private void btnChangeLanguage_Click(object sender, EventArgs e)
        {
            currentLang++;
            if (currentLang > 3) { currentLang = 0; }
            switch (currentLang)
            {
                case 0:
                    ChangeLanguage("en");
                    break;
                case 1:
                    ChangeLanguage("nl");
                    break;
                case 2:
                    ChangeLanguage("de");
                    break;
                case 3:
                    ChangeLanguage("fr");
                    break;
            }
        }

        private void ChangeLanguage(string lang)
        {
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources =
                      new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang));
            }
        }

        private void btnOpenForm_Click(object sender, EventArgs e)
        {
            Form2 newWindow2 = new Form2();
            //newWindow2.Visible = true;
            newWindow2.Show();
        }
    }
}
